///@file MathobjectTests.cpp
///@brief Implementation of the test procedures for performance
///@author Arnaud Duval
///@version 0.0
///@date 2010/11/09

#include <iostream>

#include "MathobjectTests.h"
#include "../../mathobject/include/Vector.h"

///@brief Test of Vector members
void TestVector()
{
	PrintSeparator();
	std::cout << "Test 1 : Definition de vecteurs avec valeurs en double précision :\n";
	Vector A(5);
	Vector B(6);
	Vector C(5);
	A[1] = 1.5;
	A[2] = 4.3;
	A[3] = 1./3.;
	A[4] = 7./5.;
	A[5] = 4.;

	B[1] = 6.3;
	B[2] = 7.1;
	B[3] = 5./6.;
	B[4] = 2.3;
	B[5] = 3.2;
	B[6] = 7.6;

	C[1] = 2./9.;
	C[2] = 0.1;
	C[3] = 0.;
	C[4] = 3.4;
	C[5] = 4.1;
	std::cout << "A = " << A << "\n";
	std::cout << "B = " << B << "\n";
	std::cout << "C = " << C << "\n";

	PrintSeparator();
	std::cout << "Test 2 : test de l'opérateur +\n";
	std::cout << "D = A + C\n";
	std::cout << "A = " << A << "\n";
	std::cout << "C = " << C << "\n";
	Vector D = A+C;
	std::cout << "D = " << D << "\n";

	PrintSeparator();
	std::cout << "Test 3 : test de l'opérateur -\n";
	std::cout << "E = A - C\n";
	std::cout << "A = " << A << "\n";
	std::cout << "C = " << C << "\n";
	Vector E = A-C;
	std::cout << "E = " << E << "\n";

	PrintSeparator();
	std::cout << "Test 4 : test de l'opérateur =\n";
	std::cout << "F = B\n";
	std::cout << "B = " << B << "\n";
	Vector F = B;
	std::cout << "F = " << F << "\n";

	PrintSeparator();
	std::cout << "Test 5 : norme Euclidienne\n";
	std::cout << "A.Euclide_Norm()\n";
	std::cout << "A = " << A << "\n";
	std::cout << "Norme de A = " << A.Euclide_Norm() << "\n";
	std::cout << "B.Euclide_Norm()\n";
	std::cout << "B = " << B << "\n";
	std::cout << "Norme de B = " << B.Euclide_Norm() << "\n";
	std::cout << "C.Euclide_Norm()\n";
	std::cout << "C = " << C << "\n";
	std::cout << "Norme de C = " << C.Euclide_Norm() << "\n";

	PrintSeparator();
	std::cout << "Test 6 : fonction Resize\n";
	std::cout << "E.resize(2)\n";
	std::cout << "E = " << E << "\n";
	std::cout << "Resize de E à 2\n";
	E.resize(2);
	std::cout << "E = " << E << "\n";
	std::cout << "F.resize(10)\n";
	std::cout << "F = " << F << "\n";
	std::cout << "Resize de F à 10\n";
	F.resize(10);
	std::cout << "F = " << F << "\n";

	PrintSeparator();
	std::cout << "Test 7 : fonction swap\n";
	std::cout << "A.swap(3,5)\n";
	std::cout << "A = " << A << "\n";
	std::cout << "Swap des composantes 3 et 5 dans A\n";
	A.swap(3,5);
	std::cout << "A = " << A << "\n";

	PrintSeparator();
	std::cout << "Test 8 : fonction FillSobol\n";
	std::cout << "Vector G(12); G.FillSobol();\n";
	Vector G(12);
	G.FillSobol();
	std::cout << "G = " << G << "\n";

	PrintSeparator();
	std::cout << "Test 9 : tri à bulles\n";
	std::cout << "A.BubbleSort()\n";
	std::cout << "A = " << A << "\n";
	A.BubbleSort();
	std::cout << "A = " << A << "\n";

	PrintSeparator();
	std::cout << "Test 10 : fonction Sum()\n";
	std::cout << "B = " << B << "\n";
	std::cout << "B.Sum() = " << B.Sum() << "\n";
}

///@brief Print a separator on standard output
void PrintSeparator()
{
	std::cout << "**********************************************\n";
}
